import axios from "../until/axios";
import api from "./api";

//用户注册
export const userRegister = (data) =>
  axios({
    method: "post",
    url: api.user.register,
    data,
  });

//用户登录
export const userLogin = (data) =>
  axios({
    method: "post",
    url: api.user.login,
    data,
  });

//用户详情
export const userInfo = () =>
  axios({
    method: "get",
    url: api.user.info,
    headers: {
      Authorization: window.localStorage.getItem("token"),
    },
  });
//修改个人信息
export const editUser = (data) =>
  axios({
    method: "put",
    url: api.user.edit,
    data,
    headers: {
      Authorization: window.localStorage.getItem("token"),
    },
  });

// 重置密码
export const resetPwd = (data) =>
  axios({
    method: "put",
    url: api.user.resetPwd,
    data,
    headers: {
      Authorization: window.localStorage.getItem("token"),
    },
  });
//所有订单allorder
export const getAllorder = (data = {}) =>
  axios({
    method: "GET",
    url: api.user.allorder,
    data,
    headers: {
      Authorization: window.localStorage.getItem("token"),
    },
  });
// 查询意见
// export const getFeedback = (data = {}) =>
//   axios({
//     method: "GET",
//     url: api.user.feedback,
//     data,
//     headers: {
//       Authorization: window.localStorage.getItem("token"),
//     },
//   });
//新增意见addOpinion
export const addOpinion = (data = {}) =>
  axios({
    method: "post",
    url: api.user.addOpinion,
    data,
    headers: {
      Authorization: window.localStorage.getItem("token"),
    },
  });

//上传头像
export const uploadFile = (file) =>
  axios({
    method: "post",
    url: api.user.uploadFile,
    headers: {
      "Content-Type": "multipart/form-data",
      Authorization: window.localStorage.getItem("token"),
    },
    data: file,
  });
//注销登录logout
export const logout = () =>
  axios({
    method: "post",
    url: api.user.logout,
    headers: {
      Authorization: window.localStorage.getItem("token"),
    },
  });
